<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="format-detection" content="telephone=no"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><link rel="icon" href="/blog/blog/images/icons/favicon-16x16.png?v=2.6.2" type="image/png" sizes="16x16"><link rel="icon" href="/blog/blog/images/icons/favicon-32x32.png?v=2.6.2" type="image/png" sizes="32x32"><meta property="og:type" content="website">
<meta property="og:title" content="斯人若彩虹 遇上方知有">
<meta property="og:url" content="https://bruce-jj.gitee.io/blog/archives/2021/03/page/2/index.html">
<meta property="og:site_name" content="斯人若彩虹 遇上方知有">
<meta property="og:locale" content="zh_CN">
<meta property="article:author" content="何水浪">
<meta name="twitter:card" content="summary"><title>归档 | 斯人若彩虹 遇上方知有</title><link ref="canonical" href="https://bruce-jj.gitee.io/blog/archives/2021/03/page/2/index.html"><link rel="dns-prefetch" href="https://cdn.jsdelivr.net"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.12.1/css/all.min.css" type="text/css"><link rel="stylesheet" href="/blog/css/index.css?v=2.6.2"><script>var Stun = window.Stun || {};
var CONFIG = {
  root: '/blog/',
  algolia: undefined,
  assistSearch: undefined,
  fontIcon: {"prompt":{"success":"fas fa-check-circle","info":"fas fa-arrow-circle-right","warning":"fas fa-exclamation-circle","error":"fas fa-times-circle"},"copyBtn":"fas fa-copy"},
  sidebar: {"offsetTop":"20px","tocMaxDepth":6},
  header: {"enable":true,"showOnPost":true,"scrollDownIcon":false},
  postWidget: {"endText":true},
  nightMode: {"enable":true},
  back2top: {"enable":true},
  codeblock: {"style":"default","highlight":"light","wordWrap":false},
  reward: false,
  fancybox: false,
  zoomImage: {"gapAside":"20px"},
  galleryWaterfall: undefined,
  lazyload: false,
  pjax: undefined,
  externalLink: {"icon":{"enable":true,"name":"fas fa-external-link-alt"}},
  shortcuts: undefined,
  prompt: {"copyButton":"复制","copySuccess":"复制成功","copyError":"复制失败"},
  sourcePath: {"js":"js","css":"css","images":"images"},
};

window.CONFIG = CONFIG;</script><meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/blog/atom.xml" title="斯人若彩虹 遇上方知有" type="application/atom+xml">
</head><body><div class="container" id="container"><header class="header" id="header"><div class="header-inner"><nav class="header-nav header-nav--fixed"><div class="header-nav-inner"><div class="header-nav-menubtn"><i class="fas fa-bars"></i></div><div class="header-nav-menu"><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/blog/"><span class="header-nav-menu-item__icon"><i class="fas fa-home"></i></span><span class="header-nav-menu-item__text">首页</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/blog/archives/"><span class="header-nav-menu-item__icon"><i class="fas fa-folder-open"></i></span><span class="header-nav-menu-item__text">归档</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/blog/categories/"><span class="header-nav-menu-item__icon"><i class="fas fa-layer-group"></i></span><span class="header-nav-menu-item__text">分类</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/blog/tags/"><span class="header-nav-menu-item__icon"><i class="fas fa-tags"></i></span><span class="header-nav-menu-item__text">标签</span></a></div><div class="header-nav-menu-item"><a class="header-nav-menu-item__link" href="/blog/friends/"><span class="header-nav-menu-item__icon"><i class="fas fa-link"></i></span><span class="header-nav-menu-item__text">友链</span></a></div></div><div class="header-nav-search"><span class="header-nav-search__icon"><i class="fas fa-search"></i></span><span class="header-nav-search__text">搜索</span></div><div class="header-nav-mode"><div class="mode"><div class="mode-track"><span class="mode-track-moon"></span><span class="mode-track-sun"></span></div><div class="mode-thumb"></div></div></div></div></nav><div class="header-banner"><div class="header-banner-info"><div class="header-banner-info__title">斯人若彩虹 遇上方知有</div><div class="header-banner-info__subtitle"></div></div></div></div></header><main class="main" id="main"><div class="main-inner"><div class="content-wrap" id="content-wrap"><div class="content" id="content"><div class="archive"><div class="archive-total">目前共计 48 篇文章，继续加油！</div><section class="timeline"><time class="timeline-item timeline-item--year">2021</time><article class="timeline-item"><time class="timeline-item__time">05-25</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/25/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F%E5%AD%A6%E4%B9%A0-%E5%B7%A5%E5%8E%82%E6%96%B9%E6%B3%95%E6%A8%A1%E5%BC%8F/">设计模式学习_工厂方法模式</a></h2></article><article class="timeline-item"><time class="timeline-item__time">05-23</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/23/Java%E6%8A%80%E5%B7%A7-%E9%85%8D%E7%BD%AE%E8%A7%86%E5%9B%BE%E8%A7%A3%E6%9E%90%E5%99%A8/">Java技巧_配置视图解析器</a></h2></article><article class="timeline-item"><time class="timeline-item__time">05-22</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/22/SpringSecurity%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/">Spring Security学习笔记</a></h2></article><article class="timeline-item"><time class="timeline-item__time">05-19</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/19/Java%E9%80%82%E5%BA%94%E5%89%8D%E7%AB%AFJSON%E5%8F%82%E6%95%B0-%E4%B8%87%E7%89%A9%E7%9A%86%E5%8F%AFMap/">Java适应前端JSON参数_万物皆可Map</a></h2></article><article class="timeline-item"><time class="timeline-item__time">05-18</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/18/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F%E5%AD%A6%E4%B9%A0-%E8%A3%85%E9%A5%B0%E5%99%A8%E6%A8%A1%E5%BC%8F/">设计模式学习_装饰器模式</a></h2></article><article class="timeline-item"><time class="timeline-item__time">05-17</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/17/%E6%AF%95%E4%B8%9A%E7%AD%94%E8%BE%A9-%E9%87%8D%E7%82%B9%E5%9B%BE%E8%A1%A8/">毕业答辩_重点图表</a></h2></article><article class="timeline-item"><time class="timeline-item__time">05-17</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/17/%E6%AF%95%E4%B8%9A%E7%AD%94%E8%BE%A9-%E6%80%BB%E4%BD%93%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9/">毕业答辩_总体注意事项</a></h2></article><article class="timeline-item"><time class="timeline-item__time">05-16</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/16/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F%E5%AD%A6%E4%B9%A0-%E8%A7%82%E5%AF%9F%E8%80%85%E6%A8%A1%E5%BC%8F/">设计模式学习_观察者模式</a></h2></article><article class="timeline-item"><time class="timeline-item__time">05-15</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/15/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F%E5%AD%A6%E4%B9%A0-%E7%AD%96%E7%95%A5%E6%A8%A1%E5%BC%8F/">设计模式学习_策略模式</a></h2></article><article class="timeline-item"><time class="timeline-item__time">05-12</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/12/VUE%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95%E5%8F%8A%E7%9B%B8%E5%BA%94%E5%BA%94%E7%94%A8-4/">VUE学习笔记-4-VUE小技巧</a></h2></article><article class="timeline-item"><time class="timeline-item__time">05-07</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/07/hexo%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0%E4%BB%A5%E5%8F%8A%E5%B8%B8%E8%A7%81%E9%94%99%E8%AF%AF/">Hexo学习笔记以及常见错误</a></h2></article><article class="timeline-item"><time class="timeline-item__time">05-07</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/07/%E8%8B%B1%E8%AF%AD%E5%AD%A6%E4%B9%A0-16%E4%B8%AA%E4%BB%A3%E6%9B%BFvery%E7%9A%84%E8%A1%A8%E8%BE%BE/">英语学习_16个代替very的表达</a></h2></article><article class="timeline-item"><time class="timeline-item__time">05-04</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/05/04/%E5%9F%BA%E4%BA%8EVUE-Firebase%E5%9C%A8%E7%BA%BF%E8%81%8A%E5%A4%A9%E5%AE%A4APP/">基于VUE&amp;Firebase的在线聊天室APP</a></h2></article><article class="timeline-item"><time class="timeline-item__time">04-27</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/04/27/VUE%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95%E5%8F%8A%E7%9B%B8%E5%BA%94%E5%BA%94%E7%94%A8-2/">VUE学习笔记-基础语法及其应用-2-深入组件开发</a></h2></article><article class="timeline-item"><time class="timeline-item__time">04-15</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/04/15/Java%E5%8F%8D%E5%B0%84%E6%9C%BA%E5%88%B6-%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/">Java反射机制-学习笔记</a></h2></article><article class="timeline-item"><time class="timeline-item__time">04-14</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/04/14/Java%E9%9B%86%E5%90%88%E6%A1%86%E6%9E%B6-%E5%9F%BA%E7%A1%80%E5%AD%A6%E4%B9%A0/">Java集合框架-基础学习</a></h2></article><article class="timeline-item"><time class="timeline-item__time">04-10</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/04/10/Java%E6%8A%80%E5%B7%A7-Redis%E5%AD%98%E5%82%A8/">SpringRedis_存储Map中的KV与读取</a></h2></article><article class="timeline-item"><time class="timeline-item__time">04-10</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/04/10/Java%E6%8A%80%E5%B7%A7-SpringBoot-PageHelper%E6%A0%B9%E6%8D%AE%E9%A1%B5%E6%95%B0%E6%95%B0%E6%8D%AE%E5%88%86%E9%A1%B5%E6%98%BE%E7%A4%BA/">PageHelper根据页数数据分页显示</a></h2></article><article class="timeline-item"><time class="timeline-item__time">04-09</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/04/09/%E4%B8%8D%E4%BC%9A%E5%90%A7%E8%80%83%E7%A0%94%E6%94%BF%E6%B2%BB/">政治上60分就够了？不是吧，你一定要看看</a></h2></article><article class="timeline-item"><time class="timeline-item__time">04-09</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/04/09/2021%E5%B9%B4%E8%AE%A1%E7%AE%97%E6%9C%BA%E9%87%8D%E5%BA%86%E9%82%AE%E7%94%B5%E5%A4%A7%E5%AD%A6%E7%A0%94%E7%A9%B6%E7%94%9F%E5%85%A5%E5%AD%A6%E8%80%83%E8%AF%95%E7%BB%8F%E9%AA%8C/">2021年计算机重庆邮电大学研究生入学考试经验</a></h2></article><article class="timeline-item"><time class="timeline-item__time">04-09</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/04/09/hello/">hello</a></h2></article><article class="timeline-item"><time class="timeline-item__time">04-09</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/04/09/%E4%B8%8D%E4%BC%9A%E5%90%A7%E8%80%83%E7%A0%94%E6%95%B0%E5%AD%A6/">考研数学到底怎么样才能上一百分？我来告诉你...</a></h2></article><article class="timeline-item"><time class="timeline-item__time">04-05</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/04/05/Java%E6%8A%80%E5%B7%A7-Ajax%E8%AF%B7%E6%B1%82PostAndGet/">Ajax请求PostAndGet</a></h2></article><article class="timeline-item"><time class="timeline-item__time">04-01</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/04/01/VUE%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95%E5%8F%8A%E7%9B%B8%E5%BA%94%E5%BA%94%E7%94%A8-3/">VUE学习笔记-3-SpringBoot+SpringJPA+Vue 开发实战</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-28</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/28/VUE%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-%E5%9F%BA%E7%A1%80%E8%AF%AD%E6%B3%95%E5%8F%8A%E7%9B%B8%E5%BA%94%E5%BA%94%E7%94%A8-1/">VUE学习笔记-基础语法及相应应用-1-基本语法</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-26</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/26/%E7%BF%BB%E8%AF%91%E4%BD%9C%E5%93%81-%E5%A6%82%E4%BD%95%E5%83%8F%E6%AF%8D%E8%AF%AD%E8%80%85%E4%B8%80%E6%A0%B7%E8%AF%B4%E8%8B%B1%E8%AF%AD/">翻译作品--如何像母语者一样说英语</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-26</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/26/xxx/">复试代码（仅供参考）</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-19</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/19/C-%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/">C++管理系统</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-17</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/17/C-%E9%9D%A2%E5%90%91%E5%AF%B9%E8%B1%A1%E5%9F%BA%E7%A1%80/">C++面向对象基础</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-17</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/17/SpringMVC/">SpringMVC学习笔记(所有代码FROM SIKI学院)</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-16</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/16/%E7%BF%BB%E8%AF%91%E4%BD%9C%E5%93%81-%E5%A4%A7%E6%95%B0%E6%8D%AE/">翻译作品-大数据</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-16</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/16/Spring/">Spring学习笔记(所有代码FROM SIKI学院)</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-15</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/15/JavaScript/">JavaScript学习笔记</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-15</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/15/CSS/">CSS学习笔记</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-15</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/15/MongoDB/">MongoDB学习笔记</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-15</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/15/HTML/">HTML学习笔记</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-15</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/15/%E7%BF%BB%E8%AF%91%E4%BD%9C%E5%93%81-%E5%9B%9E%E7%AD%94%E6%88%91%E4%B8%8D%E7%9F%A5%E9%81%93%E7%9A%84%E5%85%AB%E7%A7%8D%E6%96%B9%E5%BC%8F/">翻译作品-替换“我不知道”的八种更好的回答</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-13</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/13/%E7%BF%BB%E8%AF%91%E4%BD%9C%E5%93%81-%E5%9C%A8%E6%B3%95%E5%9B%BD%E7%9A%84%E7%BE%8E%E5%9B%BD%E5%B0%8F%E4%BC%99%E5%84%BF/">翻译作品_在法国的美国小伙儿</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-11</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/11/PYTHON%20%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E7%B2%BE%E9%80%9A-%E5%88%A9%E7%94%A8BeautifulSoup%20Get%20%E4%B8%8E%20Post%20%E8%AF%B7%E6%B1%82/">PYTHON 从入门到精通-Get 与 Post 请求</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-11</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/11/PYTHON%20%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E7%B2%BE%E9%80%9A-%E5%88%A9%E7%94%A8BeautifulSoup%20%E5%A6%82%E4%BD%95%E7%88%AC%E5%8F%96%E7%BD%91%E7%AB%99%E6%95%B0%E6%8D%AE/">PYTHON 从入门到精通-利用BeautifulSoup 如何爬取网站数据</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-11</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/11/PYTHON%20%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E7%B2%BE%E9%80%9A-%E5%88%A9%E7%94%A8selenium%20%E5%A6%82%E4%BD%95%E7%88%AC%E5%8F%96%E7%BD%91%E7%AB%99%E6%95%B0%E6%8D%AE/">PYTHON 从入门到精通-利用selenium 如何爬取网站数据</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-11</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/11/PYTHON%20%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E7%B2%BE%E9%80%9A-%E7%B1%BBClass/">PYTHON 从入门到精通-类Class</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-11</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/11/%E4%BB%8E%E9%9B%B6%E5%9F%BA%E7%A1%80%E5%88%9B%E5%BB%BASpringboot%20+%20Thymelear%20+%20layui%E9%A1%B9%E7%9B%AE/">从零基础创建Springboot_Thymelear_layui项目</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-11</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/11/%E7%9B%AE%E5%BD%95%E6%B5%8B%E8%AF%95/">目录测试</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-11</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/11/Mybatis/">Mybatis学习笔记(所有代码FROM SIKI学院)</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-11</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/11/%E4%B8%8D%E4%BC%9A%E5%90%A7%E8%80%83%E7%A0%94%E8%8B%B1%E8%AF%AD/">不会吧？都2021年了，还有人觉得考研英语简单！？</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-11</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/11/C_C++%20%E7%BC%96%E7%A8%8B%E5%B8%B8%E8%A7%81%E4%BB%A3%E7%A0%81/">C/C++ 编程常见代码</a></h2></article><article class="timeline-item"><time class="timeline-item__time">03-11</time><h2 class="timeline-item__title"><a class="timeline-item__link" href="/blog/2021/03/11/C_C++%E5%8A%9B%E6%89%A3LeetCode%E8%BD%AC%E8%BD%BD/">C/C++力扣LeetCode转载</a></h2></article></section></div></div></div><div class="sidebar-wrap" id="sidebar-wrap"><aside class="sidebar" id="sidebar"><section class="sidebar-toc hide"></section><!-- ov = overview--><section class="sidebar-ov"><div class="sidebar-ov-author"><div class="sidebar-ov-author__avatar"><img class="sidebar-ov-author__avatar_img" src="/blog/images/avatar.jpg" alt="avatar"></div><p class="sidebar-ov-author__text">C'est la vie</p></div><div class="sidebar-ov-state"><a class="sidebar-ov-state-item sidebar-ov-state-item--posts" href="/blog/archives/"><div class="sidebar-ov-state-item__count">48</div><div class="sidebar-ov-state-item__name">归档</div></a><a class="sidebar-ov-state-item sidebar-ov-state-item--categories" href="/blog/categories/"><div class="sidebar-ov-state-item__count">19</div><div class="sidebar-ov-state-item__name">分类</div></a><a class="sidebar-ov-state-item sidebar-ov-state-item--tags" href="/blog/tags/"><div class="sidebar-ov-state-item__count">20</div><div class="sidebar-ov-state-item__name">标签</div></a></div><div class="sidebar-ov-cc"><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en" target="_blank" rel="noopener" data-popover="知识共享许可协议" data-popover-pos="up"><img src="/blog/images/cc-by-nc-sa.svg"></a></div></section></aside></div><div class="clearfix"></div></div></main><footer class="footer" id="footer"><div class="footer-inner"><div><span>Copyright © 2021</span><span class="footer__icon"><i class="fas fa-heart"></i></span><span>何水浪</span></div><div><span>由 <a href="http://hexo.io/" title="Hexo" target="_blank" rel="noopener">Hexo</a> 强力驱动</span><span> v5.4.0</span><span class="footer__devider">|</span><span>主题 - <a href="https://github.com/liuyib/hexo-theme-stun/" title="Stun" target="_blank" rel="noopener">Stun</a></span><span> v2.6.2</span></div></div></footer><div class="loading-bar" id="loading-bar"><div class="loading-bar__progress"></div></div><div class="back2top" id="back2top"><span class="back2top__icon"><i class="fas fa-rocket"></i></span></div></div><div class="search-mask"></div><div class="search-popup"><span class="search-close"></span><div class="search-input"><input placeholder="搜索文章（支持多关键词，请用空格分隔）"></div><div class="search-results"></div></div><script src="https://cdn.jsdelivr.net/npm/jquery@v3.4.1/dist/jquery.min.js"></script><script src="https://cdn.jsdelivr.net/npm/velocity-animate@1.5.2/velocity.min.js"></script><script src="https://cdn.jsdelivr.net/npm/velocity-animate@1.5.2/velocity.ui.min.js"></script><script>function initSearch() {
  var isXML = true;
  var search_path = 'search.json';

  if (!search_path) {
    search_path = 'search.xml';
  } else if (/json$/i.test(search_path)) {
    isXML = false;
  }

  var path = '/blog/' + search_path;
  $.ajax({
    url: path,
    dataType: isXML ? 'xml' : 'json',
    async: true,
    success: function (res) {
      var datas = isXML ? $('entry', res).map(function () {
        // 将 XML 转为 JSON
        return {
          title: $('title', this).text(),
          content: $('content', this).text(),
          url: $('url', this).text()
        };
      }).get() : res;
      var $input = $('.search-input input');
      var $result = $('.search-results');
      // 搜索对象（标题、内容）的权重，影响显示顺序
      var WEIGHT = { title: 100, content: 1 };
      var searchPost = function () {
        var searchText = $input.val().toLowerCase().trim();
        // 根据空白字符分隔关键字
        var keywords = searchText.split(/[\s]+/);
        // 搜索结果
        var matchPosts = [];

        // 有多个关键字时，将原文字整个保存下来
        if (keywords.length > 1) {
          keywords.push(searchText);
        }
        // 防止未输入字符时搜索
        if (searchText.length > 0) {
          datas.forEach(function (data) {
            var isMatch  = false;
            // 没有标题的文章使用预设的 i18n 变量代替
            var title = (data.title && data.title.trim()) || '[ 文章无标题 ]';
            var titleLower = title && title.toLowerCase();
            // 删除 HTML 标签 和 所有空白字符
            var content = data.content && data.content.replace(/<[^>]+>/g, '');
            var contentLower = content && content.toLowerCase();
            // 删除重复的 /
            var postURL = data.url && decodeURI(data.url).replace(/\/{2,}/g, '/');
            // 标题中匹配到的关键词
            var titleHitSlice = [];
            // 内容中匹配到的关键词
            var contentHitSlice = [];

            keywords.forEach(function (keyword) {
              /**
              * 获取匹配的关键词的索引
              * @param {String} keyword 要匹配的关键字
              * @param {String} text 原文字
              * @param {Boolean} caseSensitive 是否区分大小写
              * @param {Number} weight 匹配对象的权重。权重大的优先显示
              * @return {Array}
              */
              function getIndexByword (word, text, caseSensitive, weight) {
                if (!word || !text) {
                  return [];
                };

                var startIndex = 0; // 每次匹配的开始索引
                var index = -1;     // 匹配到的索引值
                var result = [];    // 匹配结果

                if (!caseSensitive) {
                  word = word.toLowerCase();
                  text = text.toLowerCase();
                }

                while((index = text.indexOf(word, startIndex)) !== -1) {
                  var hasMatch = false;
                  // 索引位置相同的关键词，保留长度较长的
                  titleHitSlice.forEach(function (hit) {
                    if (hit.index === index && hit.word.length < word.length) {
                      hit.word = word;
                      hasMatch = true;
                    }
                  });
                  startIndex = index + word.length;
                  !hasMatch && result.push({ index: index, word: word, weight: weight });
                }
                return result;
              }
              titleHitSlice = titleHitSlice.concat(getIndexByword(keyword, titleLower, false, WEIGHT.title));
              contentHitSlice = contentHitSlice.concat(getIndexByword(keyword, contentLower, false, WEIGHT.content));
            });

            var hitTitle = titleHitSlice.length;
            var hitContent = contentHitSlice.length;

            if (hitTitle > 0 || hitContent > 0) {
              isMatch = true;
            }
            if (isMatch) {
              ;[titleHitSlice, contentHitSlice].forEach(function (hit) {
                // 按照匹配文字的索引的递增顺序排序
                hit.sort(function (left, right) {
                  return left.index - right.index;
                });
              });
              /**
              * 给文本中匹配到的关键词添加标记，从而进行高亮显示
              * @param {String} text 原文本
              * @param {Array} hitSlice 匹配项的索引信息
              * @param {Number} start 开始索引
              * @param {Number} end 结束索引
              * @return {String}
              */
              function highlightKeyword (text, hitSlice, start, end) {
                if (!text || !hitSlice || !hitSlice.length) {
                  return;
                }

                var result = '';
                var startIndex = start;
                var endIndex = end;
                hitSlice.forEach(function (hit) {
                  if (hit.index < startIndex) {
                    return;
                  }

                  var hitWordEnd = hit.index + hit.word.length;
                  result += text.slice(startIndex, hit.index);
                  result += '<b>' + text.slice(hit.index, hitWordEnd) + '</b>';
                  startIndex = hitWordEnd;
                });
                result += text.slice(startIndex, endIndex);
                return result;
              }

              var postData = {};
              // 文章总的搜索权重
              var postWeight = titleHitSlice.length * WEIGHT.title + contentHitSlice.length * WEIGHT.content;
              // 标记匹配关键词后的标题
              var postTitle = highlightKeyword(title, titleHitSlice, 0, title.length) || title;
              // 标记匹配关键词后的内容
              var postContent;
              // 显示内容的长度
              var SHOW_WORD_LENGTH = 200;
              // 命中关键词前的字符显示长度
              var SHOW_WORD_FRONT_LENGTH = 20;
              var SHOW_WORD_END_LENGTH = SHOW_WORD_LENGTH - SHOW_WORD_FRONT_LENGTH;

              // 截取匹配的第一个字符，前后共 200 个字符来显示
              if (contentHitSlice.length > 0) {
                var firstIndex = contentHitSlice[0].index;
                var start = firstIndex > SHOW_WORD_FRONT_LENGTH ? firstIndex - SHOW_WORD_FRONT_LENGTH : 0;
                var end = firstIndex + SHOW_WORD_END_LENGTH;
                postContent = highlightKeyword(content, contentHitSlice, start, end);
              } else { // 未匹配到内容，直接截取前 200 个字符来显示
                postContent = content.slice(0, SHOW_WORD_LENGTH);
              }
              postData.title = postTitle;
              postData.content = postContent;
              postData.url = postURL;
              postData.weight = postWeight;
              matchPosts.push(postData);
            }
          });
        }

        var resultInnerHtml = '';
        if (matchPosts.length) {
          // 按权重递增的顺序排序，使权重大的优先显示
          matchPosts.sort(function (left, right) {
            return right.weight - left.weight;
          });
          resultInnerHtml += '<ul>';
          matchPosts.forEach(function (post) {
            resultInnerHtml += '<li><a class="search-results-title" href="' + post.url + '">';
            resultInnerHtml += post.title;
            resultInnerHtml += '</a><div class="search-results-content">';
            resultInnerHtml += post.content;
            resultInnerHtml += '</div></li>';
          });
          resultInnerHtml += '</ul>';
        } else {
          resultInnerHtml += '<div class="search-results-none"><i class="far fa-meh"></i></div>';
        }
        $result.html(resultInnerHtml);
      };
      $input.on('input', searchPost);
      $input.on('keyup', function (e) {
        if (e.keyCode === Stun.utils.codeToKeyCode('Enter')) {
          searchPost();
        }
      });
    }
  });
}

function closeSearch () {
  $('body').css({ overflow: 'auto' });
  $('.search-popup').css({ display: 'none' });
  $('.search-mask').css({ display: 'none' });
}

window.addEventListener('DOMContentLoaded', function () {
  Stun.utils.pjaxReloadLocalSearch = function () {
    $('.header-nav-search').on('click', function (e) {
      e.stopPropagation();
      $('body').css('overflow', 'hidden');
      $('.search-popup')
        .velocity('stop')
        .velocity('transition.expandIn', {
          duration: 300,
          complete: function () {
            $('.search-popup input').focus();
          }
        });
      $('.search-mask')
        .velocity('stop')
        .velocity('transition.fadeIn', {
          duration: 300
        });

      initSearch();
    });
    $('.search-mask, .search-close').on('click', function () {
      closeSearch();
    });
    $(document).on('keydown', function (e) {
      // Escape <=> 27
      if (e.keyCode === Stun.utils.codeToKeyCode('Escape')) {
        closeSearch();
      }
    });
  };

  Stun.utils.pjaxReloadLocalSearch();
}, false);

function safeOpenUrl(url) {
  var newTab = window.open();
  newTab.opener = null;
  newTab.location = url;
}

function extSearch(engine) {
  var engines = {
    google: 'https://www.google.com/search?q=',
    bing: 'https://cn.bing.com/search?q=',
    baidu: 'https://www.baidu.com/s?ie=UTF-8&wd=',
  };
  var host = window.location.host;
  var query = $('.search-input input').val().toLowerCase().trim();
  var uri = engines[engine] + query + ' site:' + host;

  if (query) {
    safeOpenUrl(uri);
  } else {
    Stun.utils.popAlert('warning', '请输入字符');
  }
}

var assistSearchList = window.CONFIG.assistSearch;

if (Array.isArray(assistSearchList)) {
  assistSearchList.forEach(function (name) {
    document.querySelector('.search-btns-item--' + name).addEventListener('click', function () {
      extSearch(name);
    }, false);
  });
}</script><script src="/blog/js/utils.js?v=2.6.2"></script><script src="/blog/js/stun-boot.js?v=2.6.2"></script><script src="/blog/js/scroll.js?v=2.6.2"></script><script src="/blog/js/header.js?v=2.6.2"></script><script src="/blog/js/sidebar.js?v=2.6.2"></script><script type="application/json" src="/blog/search.json"></script></body></html>